<!DOCTYPE html>
<meta charset="UTF-8">
<title>Throwing in event listener</title>

<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>

<script>
    setup({allow_uncaught_exception:true})
    var t = async_test("Throwing in event listener");

    document.addEventListener('DOMContentLoaded', t.step_func(function(){
        var element = document.getElementById('bim');

        var secondCalled = false;

        element.addEventListener('click', function(){
            throw new Error('Error from listener');
        });
        element.addEventListener('click', t.step_func(function(){ secondCalled = true; }), false);

        element.click();

        assert_true(secondCalled);
        t.done();
    }));
</script>

<div id="bim">
</div>
